package com.maven.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.maven.demo.model.User;

@Controller
@RequestMapping("/json")
public class JsonController {
    
    /*
     * 返回json数据
     * http://127.0.0.1:8080/maven-demo/mvc/user
     * 需要几个jar包
     * */
    @RequestMapping("/user")
    public @ResponseBody User get(){
        User u = new User();
        u.setId(1);
        u.setName("jayjay");
        return u;
    }
}
